<style scoped>
.outer{height: 100%;width: 100%;flex-direction: column;justify-content: center;}
.outer h1{font-size: 60px;}
.link-list{margin-top: 20px;width: 70%;justify-content: space-between;}
.link-list>*{cursor: pointer;}
</style>
<template>
  <div class="outer flex">
    <h1>访问页面不存在</h1>
    <div class="flex link-list">
      <span @click="href_handle('/index')">返回首页</span>
      <span @click="href_handle(-1)">返回上一页</span>
    </div>
  </div>
</template>

<script>
import {href_handle} from "@/js/tool.js";

export default {
  name: "404",
  data(){
    return {
      timeout: 5000,
    }
  },
  methods: {
    href_handle: href_handle,
    loop(){
      if (this.timeout <= 0){
        let path = '/index';
        if (document.referrer && ~document.referrer.indexOf(location.host+'/sys/')) path = document.referrer.replace(/^.+\/sys/, '');
        if (path === '/login') path = '/index';
        href_handle(path);
      }else {
        this.timeout--;
        setTimeout(this.loop, 1000);
      }
    }
  },
  mounted() {
  }
}
</script>

<style scoped>

</style>
